package dcsinstnce.pds.uchiha.test;

import org.omg.CORBA.Object;

import dcsinstnce.pds.uchiha.corba.manager.CorbaManager;
import dcsinstnce.server.domaines.LocalDomaineManager;
import dcsinstnce.server.domaines.LocalDomaineManagerHelper;
import dcsinstnce.server.domaines.LocalDomaineManagerPOATie;
import dcsinstnce.server.domaines.RemoteDomaineManager;
import dcsinstnce.server.domaines.RemoteDomaineManagerHelper;
import dcsinstnce.server.domaines.impl.LocalDomaineManagerImpl;
import dcsinstnce.server.topic.impl.TopicImpl;


public class Main {
	public static void main(String[] args) {
		LocalDomaineManagerImpl domaine = new LocalDomaineManagerImpl();

		for(int i = 0;i<args.length;i++){
			TopicImpl topicI = new TopicImpl(args[i], "");
			domaine.addTopic(topicI);
		}
		
		LocalDomaineManagerPOATie domaine1 = new LocalDomaineManagerPOATie(domaine);
		
		String name = "domaine" + Math.random();
		
		Object objRef = CorbaManager.getInstance().publish(domaine1, name);
		LocalDomaineManager local = LocalDomaineManagerHelper.narrow(objRef);
		
		Object rDomaine1 = CorbaManager.getInstance().getReference("RemoteDomaine");
		RemoteDomaineManager rdomaine = RemoteDomaineManagerHelper.narrow(rDomaine1);
		rdomaine.register(local);
	}
}
